﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using IMDBApi.Contracts;
using IMDBApi.Contracts.Entities.Person.Filmography;
using IMDBApi.Contracts.Entities.Person.MainDetail;
using IMDBApi.Contracts.Entities.Person.Quotes;
using IMDBApi.Contracts.Entities.Person.Trivia;
using IMDBApi.Contracts.Entities;

namespace IMDBApi.Tests.UnitTest
{
    [TestClass]
    public class UnitTestPerson
    {
        [TestMethod]
        public void TestIMDBFilmography()
        {
            string json = new IMDBPerson("http://www.imdb.com/name/nm0000116/").GetFilmography();
            Filmography filmography = JSONSerializer.Deserialize<Filmography>(json);

            Assert.IsNotNull(filmography.Data);
        }

        [TestMethod]
        public void TestIMDBMainDetails()
        {
            string json = new IMDBPerson("http://www.imdb.com/name/nm0000116/").GetMainDetails();
            MainDetail findResults = JSONSerializer.Deserialize<MainDetail>(json);

            Assert.IsNotNull(findResults.Data);
        }

        [TestMethod]
        public void TestIMDBPhotos()
        {
            string json = new IMDBPerson("http://www.imdb.com/name/nm0000116/").GetPhotos();
            Photo photos = JSONSerializer.Deserialize<Photo>(json);

            Assert.IsNotNull(photos.Image);
        }

        [TestMethod]
        public void TestIMDBQuotes()
        {
            string json = new IMDBPerson("http://www.imdb.com/name/nm0000116/").GetQuotes();
            Quotes quotes = JSONSerializer.Deserialize<Quotes>(json);

            Assert.IsNotNull(quotes.Data);
        }

        [TestMethod]
        public void TestIMDBTrivia()
        {
            string json = new IMDBPerson("http://www.imdb.com/name/nm0000116/").GetTrivia();
            Trivia trivia = JSONSerializer.Deserialize<Trivia>(json);

            Assert.IsNotNull(trivia.Data);
        }
    }
}
